<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html>
 <head>
    <title>仓库信息管理</title>
    <!-- import css and js -->
	<%@ include file="/common/meta.jsp" %>
	<script src="${ctx}/js/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
	<script type="text/javascript" src="${ctx}/js/jsp/yd/logic/poware.js"></script>
	<script type="text/javascript">
		var basic_Url="${ctx}/yd/logic/poware";
		var basic_WUrl="yd/logic/poware";
		var basic_Title="添加";
		var show_Width=880;
		var show_Hight=500;
		function createSearch(){
			init(1,8,'100,100,100,100,100,100,100,100','10%');
			//第一行的数据
			addCommon(0,0,"lable","采购单号：");
			addCommon(0,1,"txtlike","pocode");
			addCommon(0,2,"lable","入库单号：");
			addCommon(0,3,"txtlike","powarecode");
			addCommon(0,4,"lable","仓库");
			addCommon(0,5,"selectEnum","whname","<option></option><c:forEach var="s" items="${wh}"><option value='${s.name}'>${s.name}</option></c:forEach>");
			addCommon(0,6,"lable","单据状态：");
			addCommon(0,7,"selectEnum","billStatus","<option></option><option value='0'>草稿</option>"+
					"<option value='1'>待二级审批</option><option value='2'>待三级审批</option><option value='3'>审核完成</option><option value='4'>部分退货</option>"+
			"<option value='5'>全部退货</option>");
		}
		
		function searchAP(){
			multipleSearch("#table1",true,"",basic_Url+"/list.do");
		}
		
		function checkdel(){
			var manager = $("#table1").ligerGetGridManager(); 
			var rows = manager.getSelectedRows();
			var bol = false;
			if (rows==null){
				$.dialog.alert('请选择需要操作删除的行！');
				return;
			}else{
				for(var i=0;i<rows.length;i++){
				 	if (rows[i].dcruser !='${user.name}'){
				 		bol = true;
					}
				}
				if(bol){
					$.dialog.alert('只能对本人建的单据进行删除操作!');
					return;
				}else{
					bol = false;
					for(var i=0;i<rows.length;i++){
					 	if (rows[i].billstatus>0){
					 		bol = true;
						}
					}
					if(bol){
						$.dialog.alert('草稿状态的单据才能进行删除!');
						return;
					}else{
						del();
						bol = false;
					}
				}
			}
			
		}
	</script>
	
  </head>
 <body style="padding:10px" onLoad="createSearch()">  
       <div id="layout1">
          <div class="panelBar">
	            <ul class="toolBar">
		           <li><a class="add" onclick="add()"><span>新增</span></a></li>
				   <li><a class="delete" onclick="checkdel()"><span>删除</span></a></li>
               </ul>
          </div>
          <div id="pageHeader" class="pageHeader">
               <div class="searchBar" id="multipleSearchDialog">
	                <table class="table" width="100%" id="searchHeader" >  
                        <tbody id="newbody">
                        </tbody>
 	                </table>
                    <div class="subBar">
			             <ul>
				             <li><div class="buttonActive"><div class="buttonContent"><button type="submit" id="btnSearch" onclick="searchAP()">查询</button></div></div></li>
				             <li><a class="button" onclick="clearSearch()"><span>重置</span></a></li>
			             </ul>
	                </div>
               </div>
          </div>
      </div>
      <div position="center" id="table1">
      </div>
      <div class="clear"></div>
   </div>
    </body>
</html>